//引入路由组件 
import Home from '@/pages/Home'
import Search from '@/pages/Search'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Detail from '@/pages/Detail'
import AddCartSuccess from '@/pages/AddCartSuccess'
import ShopCart from '@/pages/ShopCart'
import Trade from '@/pages/Trade'
import Pay from '@/pages/Pay'
import PaySuccess from '@/pages/PaySuccess'
import Center from '@/pages/Center'

//二级组件
import groutOrder from '@/pages/Center/groutOrder'
import myOrder from '@/pages/Center/myOrder'

//路由懒加载 按需引入组件
//const foo = () => import("@/pages/Home")


export default[
    // 重定向
    {
      path:'/',
      redirect :'/home',
      // meta 配置路由的原信息
      meta:{show:true}
    },
    {
      path:'/center',
      name:'Center',
      component:Center,
      meta:{show:true},
      children: [
        {
          path:'myorder',
          component:myOrder
        },
        {
          path:'groutorder',
          component:groutOrder
        },
        {
          path:'/center',
          redirect:'/center/myorder'
        }
      ]
    },
    {
      path:'/paysuccess',
      name:'PaySuccess',
      component:PaySuccess,
      meta:{show:true}
    },
    {
      path:'/pay',
      name:'Pay',
      component:Pay,
      meta:{show:true}
    },
    {
      path:'/trade',
      name:'Trade',
      component:Trade,
      meta:{show:true}
    },
    {
      path:'/shopcart',
      name:'ShopCart',
      component:ShopCart,
      meta:{show:true}
    },
    {
      path:'/addcartsuccess',
      name:'addcartsuccess',
      component:AddCartSuccess,
      meta:{show:true}
    },
    {
      path:'/detail/:skuid',
      component:Detail,
      meta:{show:true}
    }
    ,
    {
      path:"/home",
      component: () => import("@/pages/Home"),
      meta:{show:true}
    },
    {
      name:'search',
      path:"/search/:keyword?",
      component: () => import("@/pages/Search"),
      meta:{show:true},
    },
    {
      path:"/login",
      component: Login,
      meta:{show:false}
    },
    {
      path:"/register",
      component: Register,
      meta:{show:false}
    },
  ]